package com.m.job.logs.service.impl;

import com.m.job.logs.model.dto.MJobInstanceHistoryDto;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.m.job.logs.model.MJobInstanceHistory;
import com.m.job.logs.service.MJobInstanceHistoryService;
import com.m.job.logs.mapper.MJobInstanceHistoryMapper;

import java.util.List;

@Service
public class MJobInstanceHistoryServiceImpl implements MJobInstanceHistoryService {

	@Resource
	private MJobInstanceHistoryMapper mJobInstanceHistoryMapper;

	@Override
	public List<MJobInstanceHistoryDto> getList(MJobInstanceHistoryDto history) {
		return mJobInstanceHistoryMapper.getList(history);
	}

	@Override
	public int deleteByPrimaryKey(String intanceHistoryId) {
		return mJobInstanceHistoryMapper.deleteByPrimaryKey(intanceHistoryId);
	}

	@Override
	@Async
	public void insertSelective(MJobInstanceHistory record) {
		 mJobInstanceHistoryMapper.insertSelective(record);
	}

	@Override
	public MJobInstanceHistory selectByPrimaryKey(String intanceHistoryId) {
		return mJobInstanceHistoryMapper.selectByPrimaryKey(intanceHistoryId);
	}

	@Override
	public int updateByPrimaryKeySelective(MJobInstanceHistory record) {
		return mJobInstanceHistoryMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	@Async
	public void insertBatch(List<MJobInstanceHistory> historyList) {
		if(historyList != null && !historyList.isEmpty()){
			mJobInstanceHistoryMapper.insertBatch(historyList);
		}		
	}

}
